<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <p id="para"></p>
    <a
      href="
    https://www.bilibili.com/"
      >你好</a
    >
    <p><b>注意:</b>本示例在新框架中打开，并将被视为新的"会话":</p>
    <button onclick="history.back();">返回</button>
    <button onclick="history.forward();">前进</button>
    <button onclick="history.go(-2);">后退2页</button>
    <script>
      //获取访问的页面数
      var result = history.length;
      document.getElementById("para").innerHTML = result;

      //返回上个页面
    </script>
  </body>
</html>
